<?php
require_once('../phplib/include.inc.php');
require_once('../phplib/util/CheckLogin.inc.php');

class Admin_Subhome extends PageBase{
	public function Ini(){
		$s_name = @$_REQUEST['s_name'];
		$db = getDb();
		$sql = "SELECT * FROM subhome WHERE s_name={0}";
		$re = null;
		if(strlen($s_name) > 0) $re = $db->fetchOne($sql,array($s_name));
		else $re = $db->fetchOne("SELECT * FROM subhome WHERE s_name<>'联系信息' LIMIT 0,1");
		if(!$re) PageBase::Error("错误，找不到请求的数据");
		$oFCKeditor = new MyFckEditor('content') ;
		$oFCKeditor->Height = 400;
		$oFCKeditor->Value = $re['s_content'];
		$html = $oFCKeditor->CreateHtml();
		$this->assign("editor",$html);
		$this->assign('s_name',$s_name);
		$this->GetSubhome();
	}
	public function GetSubhome(){
		$db = getDb();
		$re = $db->fetch("SELECT * FROM subhome WHERE s_name<>'联系信息'");
		$this->assign("cats",$re);
	}
}
$a = new Admin_Subhome("file:".dirname(__FILE__)."/../admin/subhome.tpl.html");
$a->display();
?>